/*
 * Copyright (C) 2009 Kristopher T Babic
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, see <http://www.gnu.org/licenses>.
 */

package edu.idp.client.draw;

import edu.idp.shared.StoredObject;

import java.awt.*;

/**
 *
 * @author Kristopher T Babic
 */
public class DrawPencil extends Drawing {

    public DrawPencil() {
        super();
    }

    public DrawPencil(Component component) {
        super(component);
    }

    public void drawCurrent(Graphics g) {

        if (g == null)
            return;

        g.setColor(getColor());
        g.drawLine(lastPt.x, lastPt.y, curPt.x, curPt.y);

    }

    public void drawEnd(Graphics g) {
        drawCurrent(g);
    }

    public void drawStart(Graphics g) {
        drawCurrent(g);
    }

    public int getType() {
        return StoredObject.FREEHAND;
    }//DrawType.FREEHAND; }

    protected Rectangle getSubBounds(int min_x, int max_x, int min_y, int max_y) {
        return new Rectangle(min_x - 1, min_y - 1, max_x - min_x + 2, max_y - min_y + 2);
    }

    protected String storeExtra() {
        return "";
    }

    protected void restoreExtra(String S) {
    }

}
